//本地数据显示
var data = [
    {
        states : '已激活',
        tpClass : '分类一',
        tpId : 'tpId1',
        deployId : 'deployId1',
        tpIdentification : 'test_audit',
        tpName : '售前订单主流程',
        tpVersion : '1.0',
        deployTime : '2018-03-01',
        tpXML : '售前订单主流程.XML',
        tpImg : '流程图片',
        relationForm : '查看关系'
    },
    {
        states : '已激活',
        tpClass : '分类一',
        tpId : 'tpId2',
        deployId : 'deployId2',
        tpIdentification : 'test_audit',
        tpName : '售前订单主流程',
        tpVersion : '1.0',
        deployTime : '2018-03-01',
        tpXML : '售前订单主流程.XML',
        tpImg : '流程图片',
        relationForm : '查看关系'
    },
    {
        states : '已激活',
        tpClass : '分类一',
        tpId : 'tpId3',
        deployId : 'deployId3',
        tpIdentification : 'test_audit',
        tpName : '售前订单主流程',
        tpVersion : '1.0',
        deployTime : '2018-03-01',
        tpXML : '售前订单主流程.XML',
        tpImg : '流程图片',
        relationForm : '查看关系'
    }
];
mini.parse();

var grid = mini.get('tpGrid');
var url = bootPATH + "../frame/frame1/pages/";      	//路径前缀
//初始化
$(function () {
    grid.setData(data);
});
//部署
function  add() {
    var row = grid.getSelected();
    if(row){
    	mini.open({
            url: url +"activiti/datagridDetail/deploymentTp.html",
            title: "部署流程", width: 600, height: 400,
            onload: function () {
                var iframe = this.getIFrameEl();
                var data = { action: "new"};
                iframe.contentWindow.SetData(data);
            },
            ondestroy: function (action) {
            	//httpRequest();
            }
        });
    }else{
        mini.alert('请选择一条数据进行部署');
    }
}
//查看关系
function onActionRenderer(e) {
    var grid = e.sender;
    var record = e.record;
    var uid = record._uid;
    var rowIndex = e.rowIndex;

    var s = ' <a class="Edit_Button" href="javascript:editRow(\'' + uid + '\')" >查看关系</a>';

    if (grid.isEditingRow(record)) {
        s = '<a class="Update_Button" href="javascript:updateRow(\'' + uid + '\')">Update</a>'
            + '<a class="Cancel_Button" href="javascript:cancelRow(\'' + uid + '\')">Cancel</a>'
    }
    return s;
}
//关联方法(查看关系)
function editRow(row_uid) {
    var row = grid.getRowByUID(row_uid);
    if (row) {
        //grid.cancelEdit();
        //grid.beginEditRow(row);
    }
}
//关联表单
function edit(){
	var row = grid.getSelected();
	console.log(row);
}